< previous page page_54 next page >

Page 54
    LPDWORD lpReserved,             // reserved-Must be NULL
    LPDWORD lpcSubKeys,             // address of buffer for number of subkeys
    LPDWORD lpcbMaxSubKeyLen,       // address of buffer for longest
                                    // subkey name length
    LPDWORD lpcbMaxClassLen,        // address of buffer for longest
                                    // class string length
    LPDWORD lpcValues,              // address of buffer for number of
                                    value entries
    LPDWORD lpcbMaxValueNameLen,    // address of buffer for longest value
                                    // name length
    LPDWORD lpcbMaxValueLen,        // address of buffer for longest value
                                    // data length
    LPDWORD lpcbSecurityDescriptor, // address of buffer for security
                                    // descriptor length
    PFILETIME lpftLastWriteTime     // address of buffer for last write time
   );
Looks intimidating, doesn't it? Don't let the number of parameters throw you. The first one is a handle to the key you are examining. The rest of the parameters are all pointers to variables to load with information about the key. They all have the prefix LP or P (indicating a pointer). Most of them are pointers to DWORD (32-bit variables), which will use Visual Basic Long variables. Since the parameters are all pointers, they will all be declared by reference (except, of course, for the lpClass parameter, which, like most strings, is passed by value).
The Visual Basic declaration for this function is therefore
Private Declare Function RegQueryInfoKey Lib "advapi32.dll" Alias _
"RegQueryInfoKeyA" (ByVal hKey As Long, ByVal lpClass As String, _
lpcbClass As Long, lpReserved As Long, lpcSubKeys As Long, _
lpcbMaxSubKeyLen As Long, lpcbMaxClassLen As Long, lpcValues As _
Long, lpcbMaxValueNameLen As Long, lpcbMaxValueLen As Long, _
lpcbSecurityDescriptor As Long, lpftLastWriteTime As FILETIME) _
As Long
The FILETIME structure is a 64-bit structure that holds a system date. (The Win32 API provides a number of functions that work with FILETIME structures, but that is beyond the scope of this book.)
Private Type FILETIME
        dwLowDateTime As Long
        dwHighDateTime As Long
End Type

 
< previous page page_54 next page >